﻿using System.Collections.Generic;
using Web_Oto.Bases;
using Web_Oto.Data;

namespace Web_Oto.Business
{
   public class UserBus : busObject
    {
        #region Constructor

        public UserBus()
        {
            m_objDAL = new UserDal(connectionstring, connectiontype);
        }

        public UserBus(string connectionString)
            : base(connectionString)
        {
            m_objDAL = new UserDal(connectionstring, connectiontype);
        }

        public UserBus(string connectionString, string connectionType)
            : base(connectionString, connectionType)
        {
            m_objDAL = new UserDal(connectionstring, connectiontype);
        }

        private UserDal m_objDAL;

        #endregion

        #region methods

        public IList<User> GetAllUser()
        {
            return m_objDAL.GetAllUser();
        }

        public User GetUserById(int id)
        {
            return m_objDAL.GetUserById(id);
        }

        public int Delete(int id)
        {
            return m_objDAL.Delete(id);
        }

        public int Update(User user)
        {
            return m_objDAL.Update(user);
        }

        public int Insert(User user)
        {
            return m_objDAL.Insert(user);
        }

        public User GetUserByUserName(string userName)
        {
            return m_objDAL.GetUserByUserName(userName);
        }

        public User CheckUserLogin(string userName, string password)
        {
            return m_objDAL.CheckUserLogin(userName, password);
        }

       #endregion
    }
}
